package com.example.service;

import com.example.common.JwtTokenUtils;
import com.example.common.Result;
import com.example.dao.GradesDao;
import com.example.dao.PaperDao;
import com.example.entity.Admin;
import com.example.entity.Grades;
import com.example.entity.Paper;
import com.example.entity.Params;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GradesService {
    @Resource
    private GradesDao gradesDao;

    public PageInfo<Grades> findBySearch(Params params) {
        //分页查询
        PageHelper.startPage(params.getPageNum(),params.getPageSize());

        List<Grades> list = gradesDao.findBySearch(params);
        return PageInfo.of(list);
    }

    public void add(Grades grades) {
        gradesDao.insertSelective(grades);
    }
    public void update(Grades grades) {
        gradesDao.updateByPrimaryKeySelective(grades);
    }

    public void delete(Integer id) {
        gradesDao.deleteByPrimaryKey(id);
    }

    public List<Grades> findAll() {
        return gradesDao.selectAll();
    }

    public PageInfo<Grades> findBySearch2(Params params) {
        List<Grades> list = gradesDao.findBySearch2(params);
        return PageInfo.of(list);
    }

    public List<Grades> findGrades() {
        return gradesDao.findGrades();
    }

    public List<Grades> findGrade() {
        return gradesDao.findGrade();
    }

    public List<Grades> findBySearch3(Params params) {
        return gradesDao.findBySearch3(params);
    }

    public List<Grades> findAll2() {
        return gradesDao.findAll2();
    }
}
